package com.sinosoft.tcmemr.manager.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.sinosoft.tcmemr.dao.PcaseModelEntityMapper;
import com.sinosoft.tcmemr.entity.PcaseModelEntity;
import com.sinosoft.tcmemr.manager.PcaseModelManager;

@Component
public class PcaseModelManagerImpl implements PcaseModelManager {
	@Autowired
	private PcaseModelEntityMapper pcasemodelmapper;
	/**
	 * 查询病历模板
	 * @param type
	 * @param modelName
	 * @return
	 */
	public PcaseModelEntity selectByModelName(int type,String modelName){
		return pcasemodelmapper.selectByModelName(type, modelName);
	}
	/**
	 * 插入模板
	 * @param pcasemodel
	 * @return
	 */
	public boolean insertSelective(PcaseModelEntity pcasemodel){
		if( pcasemodel == null ){
			return false;
		}
		pcasemodelmapper.insertSelective(pcasemodel);
		return true;
	}
	/**
	 * 更新模板
	 * @param pcasemodel
	 * @return 
	 */
	public boolean updateByPrimaryKeySelective(PcaseModelEntity pcasemodel){
		if( pcasemodel == null ){
			return false;
		}
		pcasemodelmapper.updateByPrimaryKeySelective(pcasemodel);
		return true;
	}
	
	/**
	 * 删除模板
	 * @param id模版ID
	 * @return true/false
	 */
	public boolean deleteByPrimaryKey(Integer id){
		if( id == null ){
			return false;
		}
		pcasemodelmapper.deleteByPrimaryKey(id);
		return true;
	}
	
}
